package x.socket;

import java.util.concurrent.atomic.AtomicInteger;

import javax.servlet.http.HttpServletRequest;

import org.apache.catalina.websocket.StreamInbound;
import org.apache.catalina.websocket.WebSocketServlet;

public class MySocketServlet extends WebSocketServlet {
	
	private static final long serialVersionUID = -1696415776667211663L;
	private final AtomicInteger connectionIds = new AtomicInteger(0);
    private static final String GUEST_PREFIX = "Guest";

	@Override
	protected StreamInbound createWebSocketInbound(String arg0,
			HttpServletRequest arg1) {

		return new MyMessage(GUEST_PREFIX+" "+connectionIds.incrementAndGet());
	}
}
